<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<div class="span12 box-content">
	<div class="well"><h3>修改题目信息</h3>带<span style="color: red;" >*</span>为必填项目</div>
	<div class="span1"></div><div id="project_edit_alert_container" class="span4"></div><br/>
	<form class="form-horizontal span11" id="project_edit_form" >
		<input name="project_id"size="16" type="hidden" value="${project.id }">
		<div class="control-group">
			<label class="control-label">题目名称</label>
			<div class="controls">
				<input name="project_name"size="16" type="text" value="${project.name}" >
				<span class="help-inline" style="color: red;">*</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">所属学院</label>
			<div class="controls">
				<c:if test="${!user.superAdmin }">
					<c:set var="cglDisable" value="disabled"/>
				</c:if>
				<select  name="college"  ${cglDisable }>
					<c:forEach items="${colleges }" var="c" >
						<option value="${c.id }" ${c.id==prjClgId?"selected":"" }>${c.name }</option>
					</c:forEach>
				</select>
				<span class="help-inline" style="color: red;">*</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">所属系</label>
			<div class="controls">
				<select  name="department">
					<c:forEach items="${departments }" var="d" >
						<option value="${d.id }" ${d.id==prjDepId?"selected":"" }>${d.name }</option>
					</c:forEach>
				</select>
				<span class="help-inline" style="color: red;">*</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label" >指导教师</label>
			<div class="controls">
			<select name="teacher" data-placeholder="请选择指导教师" data-rel="chosen" data-org="${project.teacher.id }">
				<option></option>
			 </select>
			<span class="help-inline" style="color: red;">*</span>
			</div>
		 </div>
		<div class="control-group">
			<label class="control-label" >评阅人</label>
			<div class="controls">
			<select name="shengyue_teacher" data-placeholder="请选择评阅人" data-rel="chosen" data-org="${project.shengyue_teacher.id }">
				<option></option>
			 </select>
			<span class="help-inline" style="color: red;">*</span>
			</div>
		 </div>
		 <div class="control-group">
			<label class="control-label" >适用专业方向</label>
			<div class="controls">
				<div style="display: none;"class="orgBranches"><c:forEach items="${project.profs}" var="pp">${pp.branch.id},</c:forEach></div>
				<select name="branche" data-placeholder="请选择专业方向" data-rel="chosen" multiple="multiple">
					<option></option>
				 </select>
				<span class="help-inline" style="color: red;">*</span>
			</div>
		 </div>
		 <div class="control-group">
			<label class="control-label" >题目描述</label>
			<div class="controls">
			<script id="project_desc" name="project_desc" type="text/plain">${project.description}</script>
			<script type="text/javascript">
				UE.getEditor('project_desc',{
					minFrameHeight: 220,
			 	   initialFrameWidth : '60%',
			 	   initialFrameHeight: 200
				}).sync();
			</script>
			</div>
		 </div>
		<div class="form-actions">
			<button type="button" class="btn" onclick="history.go(-1)">取消并返回</button>
			<button type="button" class="btn btn-primary"id="project_edit_form_save">保存并返回</button>
		</div>
	</form>
</div>
<div class="span11" style="
    border: 1px solid #C0C0C0;
    -webkit-border-radius: 4px;  -moz-border-radius: 4px;
    margin-bottom: 3%;
    border-radius: 4px; 
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    padding: 10px;
">
	<div class="well">题目附件管理</div>
	<div>
		<table class="table table-striped table-bordered">
			<thead>
			 <tr role="row">
			 	<th>附件名称</th>
		 		<th>是否上传</th>
		 		<th>操作</th>
		 		</tr>
		 	</thead>
		 	<tbody>
		 		<tr>
		 			<c:if test="${empty project.attach_file}">
		 				<c:set var="hasAttachFile" value="0"/>
		 			</c:if>
		 			<c:if test="${!empty project.attach_file}">
		 				<c:set var="hasAttachFile" value="1"/>
		 			</c:if>
		 			<td>题目附件</td>
		 			<td>
			 			<c:if test="${hasAttachFile==1}">
			 				有
			 			</c:if>
			 			<c:if test="${hasAttachFile!=1}">
			 				无
			 			</c:if>
		 			</td>
		 			<td>			 			
		 				<c:if test="${hasAttachFile==1}">
		 					<a href="${project.attach_file}" class="btn btn-primary">下载</a>
			 				<button class="btn btn-info project_file_upload" data-type="1" data-isnew="0">重新选择文件</button>
			 				<button class="btn btn-danger project_file_delete" data-type="1" >删除</button>
			 			</c:if>
			 			<c:if test="${hasAttachFile!=1}">
			 				<button class="btn btn-info project_file_upload" data-type="1" data-isnew="1" >上传文件</button>
			 			</c:if>
			 		</td>
		 		</tr>
		 		<tr>
		 			<c:if test="${empty project.taskBook}">
		 				<c:set var="hasTaskBook" value="0"/>
		 			</c:if>
		 			<c:if test="${!empty project.taskBook}">
		 				<c:set var="hasTaskBook" value="1"/>
		 			</c:if>
		 			<td>任务书</td>
		 			<td>
			 			<c:if test="${hasTaskBook==1}">
			 				有
			 			</c:if>
			 			<c:if test="${hasTaskBook!=1}">
			 				无
			 			</c:if>
		 			</td>
		 			<td>			 			
		 				<c:if test="${hasTaskBook==1}">
		 					<a href=" ${project.taskBook}" class="btn btn-primary">下载</a>
			 				<button class="btn btn-info project_file_upload" data-type="2" data-isnew="0" >重新选择文件</button>
			 				<button class="btn btn-danger project_file_delete" data-type="2" >删除</button>
			 			</c:if>
			 			<c:if test="${hasTaskBook!=1}">
			 				<button class="btn btn-info project_file_upload" data-type="2" data-isnew="1" >上传文件</button>
			 			</c:if>
			 		</td>
		 		</tr>
		 		<c:if test="${!empty project.student.id }">
		 		<tr>
		 			<c:if test="${empty project.essayPath}">
		 				<c:set var="hasEssay" value="0"/>
		 			</c:if>
		 			<c:if test="${!empty project.essayPath}">
		 				<c:set var="hasEssay" value="1"/>
		 			</c:if>
		 			<td>最终毕业论文</td>
		 			<td>
			 			<c:if test="${hasEssay==1}">
			 				有
			 			</c:if>
			 			<c:if test="${hasEssay!=1}">
			 				无
			 			</c:if>
		 			</td>
		 			<td>			 			
		 				<c:if test="${hasEssay==1}">
		 					<a href="${project.essayPath}" class="btn btn-primary">下载</a>
			 				<button class="btn btn-info project_file_upload" data-type="3" data-isnew="0" >重新选择文件</button>
			 				<button class="btn btn-danger project_file_delete" data-type="3" >删除</button>
			 			</c:if>
			 			<c:if test="${hasEssay!=1}">
			 				<button class="btn btn-info project_file_upload" data-type="3" data-isnew="1" >上传文件</button>
			 			</c:if>
			 		</td>
		 		</tr>
		 		</c:if>
		 	</tbody>
		 </table>
	</div>
</div>
<!-- 删除确认 开始-->
<div class="modal hide fade" id="project_file_delete_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3></h3>
	</div>
	<div class="modal-body">
		<input type="hidden" name="deleteType">
            确认删除?删除动作不可撤销!
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-danger" id="project_file_delete_box_delete">删除</a>
	</div>
</div>
<!-- 删除确认 结束 -->
<!-- 上传 开始-->
<div class="modal hide fade" id="project_file_upload_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3></h3>
	</div>
	<div class="modal-body">
		<div id="project_file_upload_box_alert_container" ></div><br/>
		<input type="hidden" name="uploadType">
		<span class="btn btn-success fileinput-button" id="project_file_upload_box_file">
			<span>选择文件</span>
			<input type="file" name="file"  >
		</span>
		<span id="project_file_upload_box_file_name">未选择</span>
		<div class="progress progress-info progress-striped" style="margin-top: 3%;display:none" id="project_file_upload_box_progress">
				<div class="bar" style="width: 0%" ></div>
		</div>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-primary" id="project_file_upload_box_file_confirm">确定</a>
	</div>
</div>
<!-- 上传 结束 -->